package com.xiangge.domain;
/*
    矩形类
 */
public class Rectangle {
    // 长属性
    private double chang;
    // 宽属性
    private double kuan;

    // 构造方法
    public Rectangle() {
    }
    public Rectangle(double chang, double kuan) {
        this.chang = chang;
        this.kuan = kuan;
    }

    // getter and setter
    public double getChang() {
        return chang;
    }

    public void setChang(double chang) {
        this.chang = chang;
    }

    public double getKuan() {
        return kuan;
    }

    public void setKuan(double kuan) {
        this.kuan = kuan;
    }
    // 求面积的方法
    public double getArea(){
        return chang * kuan;
    }

    // 求周长的方法
    public double getPerimeter(){
        return (chang + kuan) * 2;
    }
    // 打印信息
    public void getInfo(){
        System.out.println("长：" + this.chang + " 宽：" + this.kuan + " 面积：" + getArea() + " 周长：" + getPerimeter());
    }
}
